<ol class="breadcrumb">
    <li> <i class="fa fa-anchor"></i>
        &nbsp;地区运营管理
    </li>
    <li>修改信息</li>
</ol>

<div class="col-xs-12 info-center" >
    <div class="bs-callout bs-callout-warning">
        <h4>
            系统使用单位: <strong>{:C('COLLEGE_NAME')}</strong>
        </h4>
    </div>
</div>

<div class="col-xs-12 info-center">
    <div class="panel panel-mcit">
        <div class="panel-heading">
            <i class="fa fa-list"></i>
            &nbsp;&nbsp;运营商信息修改
        </div>
        <div class="panel-body">
            <div class="alert alert-warning">
                <p><i class="fa fa-paperclip"></i>&nbsp;修改运营商信息</p>
            </div>
            <form class="mcit-dataform" id="data_form" method="post" action={:U("Operation/editOper")} enctype="multipart/form-data">
                <div class="panel-footer">
                    <div class="panel-mcit">

                        <div class="col-xs-6">
                            <div class="input-group">
                                <span class="input-group-addon">账号</span>
                                <input type="hidden" name="id" value="{$oper.id}"/>
                                <input type="text"   class="form-control" name="oper_login_name" value="{$oper.oper_login_name}" readonly>
                            </div>
                        </div>
                        <div class="clearfix" ></div>

                        <div class="col-xs-6">
                            <div class="input-group">
                                <span class="input-group-addon">运营商名称</span>
                                <input type="text" id="phone"   name="oper_name" class="form-control" value="{$oper.oper_name}">
                            </div>
                        </div>
                        <div class="clearfix" ></div>



						<div class="col-xs-6">
							<div class="input-group">
								<span class="input-group-addon">可选地区</span>
								<select id="selectL" name="selectL" multiple="multiple"  class="input-sm">
									<volist name="oper.outareas" id="vo">

									<option value="{$vo.id}">{$vo.city}({$vo.area})</option>

									</volist>

								</select>
							</div>
							
							<div class="select_opt">
								<p id="toright" title="添加">&gt;</p>
								<p id="toleft" title="移除">&lt;</p>
							</div>
							<div class="input-group">
								<span class="input-group-addon">已选地区</span>
								<select id="selectR" name="selectR" multiple="multiple"  class="input-sm">
									<volist name="oper.inareas" id="vo">

									<option value="{$vo.id}">{$vo.city}({$vo.area})</option>

									</volist>

								</select>
							</div>

						</div>


						<div class="col-xs-6">
                            <div class="input-group">
                                <span class="input-group-addon">详细地址</span>
                                <input type="text" id="address"  name="address" class="form-control" value="{$oper.address}">
                            </div>
                        </div>
                        <div class="clearfix" ></div>

                        <div class="col-xs-6">
                            <button id="savebase" type="submit" class="btn btn-warning"><i class="fa fa-upload"></i>&nbsp;保存</button>
                            <a href="javascript:history.go(-1);" class="btn btn-warning"><i class="fa fa-mail-reply"></i>&nbsp;返回</a>
                        </div>
                        <div class="clearfix"></div>

                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<!--修改密码-->
<div class="col-xs-12 info-center">
    <div class="panel panel-mcit">
        <div class="panel-heading">
            <i class="fa fa-list"></i>
            &nbsp;&nbsp;密码设置
        </div>
        <div class="panel-body">
            <div class="alert alert-warning">
                <p><i class="fa fa-paperclip"></i>&nbsp;重设密码</p>
            </div>
            <form class="mcit-dataform" id="data_form1" method="post" action={:U("Operation/editOperPwd")}>
                <div class="panel-footer">
                    <div class="panel-mcit">

                        <div class="col-xs-6">
                            <div class="input-group">
                                <span class="input-group-addon">账号</span>
                                <input type="hidden" name="id" value="{$oper.id}"/>
                                <input type="text"   class="form-control" name="oper_login_name" value="{$oper.oper_login_name}" readonly>
                            </div>
                        </div>
                        <div class="clearfix" ></div>

                        <div class="col-xs-6">
                            <div class="input-group">
                                <span class="input-group-addon">新密码</span>
                                <input type="password" id="pwd1"   name="pwd1" class="form-control" >
                            </div>
                        </div>
                        <div class="clearfix" ></div>

                        <div class="col-xs-6">
                            <div class="input-group">
                                <span class="input-group-addon">重复密码</span>
                                <input type="password" id="pwd2"  name="pwd2" class="form-control" >
                            </div>
                        </div>
                        <div class="clearfix" ></div>

                        <div class="col-xs-6">
                            <button type="submit" id="savebase" class="btn btn-warning"><i class="fa fa-upload"></i>&nbsp;保存</button>
                            <a href="javascript:history.go(-1);" class="btn btn-warning"><i class="fa fa-mail-reply"></i>&nbsp;返回</a>
                        </div>
                        <div class="clearfix"></div>

                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<import file="js.jquery#chained" />
<script>

    $("#location-s").chained("#location-f");
    $("#location_change").on("click",function(){
        $(this).parents('.col-xs-6').hide();
        $("#l_before").show();
        $("#location").attr('disabled',true);
    });

    $("#data_form").ajaxForm({
        dataType:'json',
        clearForm:true,
        beforeSubmit:function(){
            if($("#phone").val()==''){
                alertify.error("请填运营商名称");
                return false;
            }
            if($("#address").val()==''){
                alertify.error("请填写详细地址");
                return false;
            }
            return true
        },
        success:function(data){
            if(data.state==100){
                alertify.success(data.msg);
                location.href = data.url;
            }else{
                alertify.error(data.msg);
                alert(data.msg);
            }
        }
    });
    $("#data_form1").ajaxForm({
        dataType:'json',
        clearForm:true,
        beforeSubmit:function(){
            if($("#pwd1").val()==''){
                alertify.error("请填写新密码！");
                return false;
            }else if($("#pwd1").val().length < 8){
                alertify.error("密码最少8位！");
                return false;
            }
            if($("#pwd2").val()==''){
                alertify.error("请再次输入密码！");
                return false;
            }else if($("#pwd2").val().length < 8){
                alertify.error("密码最少8位！");
                return false;
            }else if($("#pwd1").val() != $("#pwd2").val()){
                alertify.error("两次密码输入不一致，请重新输入！");
                return false;
            }
            return true
        },
        success:function(data){
            if(data.state==100){
                alertify.success(data.msg);
                location.href = data.url;
            }else{
                alertify.error(data.msg);
                //alert(data.msg);
            }
        }
    });
</script>

<script type="text/javascript">
$(function(){
    var leftSel = $("#selectL");
	var rightSel = $("#selectR");
	$("#toright").bind("click",function(){		
		leftSel.find("option:selected").each(function(){
			$(this).remove().appendTo(rightSel);
		});
	});
	$("#toleft").bind("click",function(){		
		rightSel.find("option:selected").each(function(){
			$(this).remove().appendTo(leftSel);
		});
	});
	leftSel.dblclick(function(){
		$(this).find("option:selected").each(function(){
			$(this).remove().appendTo(rightSel);
		});
	});
	rightSel.dblclick(function(){
		$(this).find("option:selected").each(function(){
			$(this).remove().appendTo(leftSel);
		});
	});
	
	$("#savebase").click(function(){ 
		var selVal = [];
		
		rightSel.find("option").each(function(){
			selVal.push(this.value);
		});
		selVals = selVal.join(",");
		
		
	      var tmpInput = document.createElement("input"); 
	      tmpInput.type = "text"; 
	      tmpInput.name = "inareas"; 
	      
	      
	      tmpInput.setAttribute("style", "display:none") ; 
	      tmpInput.value = selVals; 
	      

	      
 	     var data_form = document.getElementById("data_form");

	      data_form.appendChild(tmpInput); 
		
/* 	      data_form.method = "post"; 
	      data_form.action = "{:U("Operation/editOper")}";  
	      data_form.submit();  */  
	}); 
	
	
	

});


</script>


